package at.ac.univie.zsu.aguataplan.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;

/**
 * @author gerry
 * 
 */
@Entity
public class Plays extends Working {

	@NotNull
	@Column
	private int playFrom;

	@NotNull
	@Column
	private int playTo;

	@ManyToOne
	private Game refGame;

	// ----------------------------------------------------
	// CONSTRUCTOR
	// ----------------------------------------------------

	public Plays() {

	}

	// ----------------------------------------------------
	// METHODS
	// ----------------------------------------------------

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Id: ").append(getId()).append(", ");
		sb.append("PlayFrom: ").append(getPlayFrom()).append(", ");
		sb.append("PlayTo: ").append(getPlayTo()).append(", ");
		sb.append("RefGame: ").append(getRefGame()).append(", ");
		sb.append("RefPlayer: ").append(getRefPlayer()).append(", ");
		sb.append("RefWorkingDescription: ")
				.append(getRefWorkingDescription() == null ? "null"
						: getRefWorkingDescription().size()).append(", ");
		sb.append("Version: ").append(getVersion());
		return sb.toString();
	}

	// ----------------------------------------------------
	// GETTER & SETTER
	// ----------------------------------------------------

	public int getPlayFrom() {
		return playFrom;
	}

	public void setPlayFrom(int playFrom) {
		this.playFrom = playFrom;
	}

	public int getPlayTo() {
		return playTo;
	}

	public void setPlayTo(int playTo) {
		this.playTo = playTo;
	}

	public Game getRefGame() {
		return refGame;
	}

	public void setRefGame(Game refGame) {
		this.refGame = refGame;
	}
}
